/*
Rilego - An easy Images 2 E-Book converter.
Copyright (C) 2011  Federico Improta (Kirys)

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */
package it.kirys.rilego.gui;

import java.awt.Point;
import javax.swing.JScrollPane;
import javax.swing.JViewport;

/**
 * About box with license info
 * @author Federico Improta
 */
public class AboutBox extends javax.swing.JDialog {

	/** Creates new form AboutBox */
	public AboutBox(java.awt.Frame parent, boolean modal) {
		super(parent, modal);
		initComponents();
		CopyRightLabel.setText("Copyright 2011 Federico Improta");
		LicenseText.setCaretPosition(0);
		ReleaseHistoryText.setCaretPosition(0);
	}
	
	/** This method is called from within the constructor to
	 * initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is
	 * always regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")
   // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
   private void initComponents() {

      OkButton = new javax.swing.JButton();
      AboutLabel = new javax.swing.JLabel();
      TabPanel = new javax.swing.JTabbedPane();
      LicenseScroll = new javax.swing.JScrollPane();
      LicenseText = new javax.swing.JTextArea();
      ReleaseHistoryScroll = new javax.swing.JScrollPane();
      ReleaseHistoryText = new javax.swing.JTextArea();
      CopyRightLabel = new javax.swing.JLabel();

      setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

      OkButton.setText("Ok");
      OkButton.addActionListener(new java.awt.event.ActionListener() {
         public void actionPerformed(java.awt.event.ActionEvent evt) {
            OkButtonActionPerformed(evt);
         }
      });

      AboutLabel.setFont(new java.awt.Font("Dialog", 1, 24)); // NOI18N
      AboutLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/logo/Rilego64.png"))); // NOI18N
      AboutLabel.setText(GuiVersionInfo.APP_FULLNAME);

      LicenseText.setColumns(20);
      LicenseText.setRows(5);
      LicenseText.setText(GuiVersionInfo.getLicense());
      LicenseText.setSelectionEnd(0);
      LicenseText.setSelectionStart(0);
      LicenseScroll.setViewportView(LicenseText);

      TabPanel.addTab("License", LicenseScroll);

      ReleaseHistoryText.setColumns(20);
      ReleaseHistoryText.setEditable(false);
      ReleaseHistoryText.setRows(5);
      ReleaseHistoryText.setText(GuiVersionInfo.getHistory());
      ReleaseHistoryScroll.setViewportView(ReleaseHistoryText);

      TabPanel.addTab("Release History", ReleaseHistoryScroll);

      CopyRightLabel.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
      CopyRightLabel.setText("jLabel1");

      javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
      getContentPane().setLayout(layout);
      layout.setHorizontalGroup(
         layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
         .addGroup(layout.createSequentialGroup()
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
               .addGroup(layout.createSequentialGroup()
                  .addContainerGap()
                  .addComponent(AboutLabel))
               .addGroup(layout.createSequentialGroup()
                  .addGap(75, 75, 75)
                  .addComponent(CopyRightLabel))
               .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                  .addContainerGap()
                  .addComponent(TabPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 633, Short.MAX_VALUE))
               .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                  .addContainerGap()
                  .addComponent(OkButton, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)))
            .addContainerGap())
      );
      layout.setVerticalGroup(
         layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
         .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
            .addGap(11, 11, 11)
            .addComponent(AboutLabel)
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
            .addComponent(CopyRightLabel)
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addComponent(TabPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 235, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addComponent(OkButton)
            .addContainerGap())
      );

      pack();
   }// </editor-fold>//GEN-END:initComponents

	 private void OkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OkButtonActionPerformed
		 this.setVisible(false);
	 }//GEN-LAST:event_OkButtonActionPerformed
   // Variables declaration - do not modify//GEN-BEGIN:variables
   private javax.swing.JLabel AboutLabel;
   private javax.swing.JLabel CopyRightLabel;
   private javax.swing.JScrollPane LicenseScroll;
   private javax.swing.JTextArea LicenseText;
   private javax.swing.JButton OkButton;
   private javax.swing.JScrollPane ReleaseHistoryScroll;
   private javax.swing.JTextArea ReleaseHistoryText;
   private javax.swing.JTabbedPane TabPanel;
   // End of variables declaration//GEN-END:variables
}
